const router = require('koa-router')();

let routerfiles = require(__dirname+'/'+'produce.js');

for(let o in routerfiles){
    let meth = o.split(' ')[0]
    let url = o.split(' ')[1]
    let fn = routerfiles[o];
    // console.log(meth,url,fn);
    if(meth == 'get'){
        router.get(url,fn)
    }else if(meth=='post'){
        router.post(url,fn)
    }else if(meth=='delete'){
        router.delete(url,fn)
    }else if(meth=='put'){
        router.put(url,fn)
    }
}

module.exports = router.routes()